package com.xm.servlet;

import com.xm.biz.GoodsBiz;
import com.xm.biz.impl.GoodsBizImpl;
import com.xm.po.Goods;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author xie'lin'feng
 * @date 2020-08-12-16:15
 * @description 商品详情处理器
 */
@WebServlet("/info")
public class GoodsInfoServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        //获取条件编号
        String id = req.getParameter("id");
        GoodsBiz goodsBiz = new GoodsBizImpl();
        Goods goodsOne = goodsBiz.getGoodsByGoodsId(Integer.valueOf(id));

        req.setAttribute("goodsOne",goodsOne);
        req.getRequestDispatcher("introduction.jsp").forward(req,resp);
    }
}
